﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MsTestUtilities.Utilities
{
    public static class XAssert
    {
        public static void AreEqual<T>(T expected, T actual, IComparer<T> comparer)
        {
            AreEqual(expected, actual, (e, a) => comparer.Compare(e, a) == 0);
        }

        public static void AreEqual<T>(T expected, T actual, Func<T, T, bool> comparer)
        {
            if (!comparer(expected, actual))
            {
                var message = string.Format("Expected <{0}>. Actual <{1}>", expected, actual);
                throw new AssertFailedException(message);
            }
        }
    }
}
